PagesSection Class [IIS 7 and higher]

Represents the <pages> section of a Web.config file.

Syntax

class PagesSection : ConfigurationSectionWithCollection

Methods

The following table lists the methods exposed by the PagesSection class.

Name

Description

Add

(Inherited from ConfigurationSectionWithCollection.)

Clear

(Inherited from ConfigurationSectionWithCollection.)

Get

(Inherited from ConfigurationSectionWithCollection.)

GetAllowDefinition

(Inherited from ConfigurationSection.)

GetAllowLocation

(Inherited from ConfigurationSection.)

Remove

(Inherited from ConfigurationSectionWithCollection.)

RevertToParent

(Inherited from ConfigurationSection.)

SetAllowDefinition

(Inherited from ConfigurationSection.)

SetAllowLocation

(Inherited from ConfigurationSection.)

Properties

The following table lists the properties exposed by the PagesSection class.

Name

Description

AsyncTimeout

A read/write datetime value that specifies the time that the page will wait to perform asynchronous tasks. The default is 45 seconds.

AutoEventWireup

A read/write boolean value. true if events for ASP.NET pages are automatically connected to event-handling functions; otherwise, false. The default is true.

NoteNote:
When this property is true, ASP.NET does not require events to specify event handlers such as Page_Load or Page_Init. This means that the Handles keyword in Visual Basic is not required in the server script in the Web Forms page. By default, when the ASP.NET Web application is created in Visual Studio, the value of the AutoEventWireup property is set to false in the .aspx page or .ascx control, and event handlers are not automatically created. Do not set AutoEventWireup to true if performance is a key consideration.

Buffer

A read/write boolean value. true if .aspx pages and .ascx controls use response buffering; otherwise, false. The default is true.

NoteNote:
When response buffering is turned on, the page or control output is buffered until after the entire page or control is processed. Do not set this property to true if performance is a key consideration.

CompilationMode

A read/write sint32 enumeration that specifies whether .aspx pages and .ascx controls are compiled at run time. The possible values are listed later in the Remarks section.

Controls

A TagPrefixInfo value that contains configuration information for custom and user controls.

EnableEventValidation

A boolean value. true if event validation should be performed; otherwise, false. The default is true.

The event-validation mechanism eliminates the risk of unauthorized postback requests and callbacks from a control. During rendering, a control registers its events and then validates only those specific events that can be raised on the control during a postback request or callback. All event-driven controls in ASP.NET now use this feature by default. However, you can revert to .NET Framework version 1.0 behavior by optionally disabling event validation for a Web application.

NoteNote:
The base control checks this property to determine whether it should validate events. A derived control does not inherit this base control setting, so by default it is exempt from event validation. You can still instruct ASP.NET to perform event validation on the derived control by adding the EnableEventValidation property to the derived control itself and setting it to true.

EnableSessionState

A read/write sint32 value that specifies whether session state is enabled. The possible values are listed later in the Remarks section.

EnableViewState

A read/write boolean value. true if view state is enabled; otherwise, false. The default is true.

EnableViewStateMac

A read/write boolean value. true if ASP.NET should run a message authentication check on the page's view state when the page is posted back from the client; otherwise, false. The default is true.

NoteNote:
For security reasons, this property should always be set to true.

Location

(Inherited from ConfigurationSection.) A key property.

MaintainScrollPositionOnPostBack

A read/write boolean value. true if the browser page-scroll position should be maintained after postback; otherwise, false. The default is false.

MasterPageFile

A read/write string value that specifies a reference to the master page for the application. The string can contain either a relative or an absolute path.

MaxPageStateFieldLength

A read/write sint32 value that specifies the maximum number of characters that a single view-state field can contain. The default is –1 (no limit specified).

If the length of the stored data exceeds the value specified, the data is split between multiple view-state fields.

Namespaces

A NamespaceInfo value that contains namespace references that are automatically imported into all the pages of a Web application. This makes the classes of the specified namespaces available for use on the page.

PageBaseType

A read/write string value that specifies a code-behind class that .aspx pages inherit by default. The default is "System.Web.UI.Page".

PageParserFilterType

A read/write string value that specifies the parser filter type. A parser filter is an instance of the PageParserFilter class. At run time, the page compilation process calls the parser filter to check for changes to the source code before the page is parsed.

Path

(Inherited from ConfigurationSection.) A key property.

SectionInformation

(Inherited from ConfigurationSection.)

SmartNavigation

A read/write boolean value. true if smart navigation is enabled; otherwise, false. The default is false.

NoteNote:
Smart navigation requires Microsoft Internet Explorer 5.5, 6, or 7.

StyleSheetTheme

A read/write string value that specifies the name of an ASP.NET style sheet theme.

TagMapping

A TagMapInfo value that contains configuration tag remapping statements. This property allows you to remap the types of tags at compile time. The remapping causes the mapped type to be used in place of the original tag type for all pages and controls in the ASP.NET application in the scope of the configuration file.

Theme

A read/write string value that specifies the name of an ASP.NET page theme.

UserControlBaseType

A read/write string value that specifies a code-behind class that user controls inherit by default. The default is "System.Web.UI.UserControl".

ValidateRequest

A read/write boolean value. true if ASP.NET performs request validation on all input from the browser; otherwise, false. The default is true.

Request validation is performed by comparing input data to a list of potentially dangerous values. If a match occurs, ASP.NET raises an HttpRequestValidationException.

ViewStateEncryptionMode

A read/write sint32 enumeration that specifies the encryption mode that ASP.NET uses for view-state values. The possible values are listed later in the Remarks section.

Subclasses

This class contains no subclasses.

Remarks

The following table lists the possible values for the CompilationMode property. The default is 2 (Always).

Value

Keyword

Description

0

Auto

ASP.NET does not compile the page, if possible.

1

Never

The page or control is never dynamically compiled. This setting increases performance by disqualifying the specified page from the compilation process. If a page contains a script block or code construct that requires compilation, ASP.NET returns an error and the page does not run.

2

Always

The page should always be compiled. 

The following table lists the possible values for the EnableSessionState property. The default is 2 (True).

Value

Keyword

Description

0

False

The session state is disabled.

1

ReadOnly

The session state is read-only.

2

True

The session state is enabled.

The following table lists the possible values for the ViewStateEncryptionMode property. The default is 0 (Auto).

Value

Keyword

Description

0

Auto

The view-state information is encrypted if a control requests encryption by calling the PageRegisterRequiresViewStateEncryption()()()() method.

1

Always

The view-state information is always encrypted.

2

Never

The view-state information is never encrypted, even if a control requests it.

Inheritance Hierarchy

ConfigurationSection

   ConfigurationSectionWithCollection

      PagesSection

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

AspSession Class [IIS 7 and higher]

ConfigurationSectionWithCollection Class [IIS 7 and higher]

NamespaceInfo Class [IIS 7 and higher]

SessionPageStateSection Class [IIS 7 and higher]

SessionStateSection Class [IIS 7 and higher]

TagMapElement Class [IIS 7 and higher]

TagMapInfo Class [IIS 7 and higher]

TagPrefixElement Class [IIS 7 and higher]

TagPrefixInfo Class [IIS 7]

IModulePageInitialize(Module, ModulePageInfo, Object)

PageRegisterRequiresViewStateEncryption()()()()

PagesSection

HttpRequestValidationException

Other Resources

CompilationMode Enumeration